<template>
  <div class="sys-user-query-form">
    <el-form ref="queryForm" :model="queryForm" :inline="true">

      <el-form-item prop="name">
        <el-input
          v-model="queryForm.name"
          placeholder="姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item prop="type">
        <el-select
          v-model="queryForm.type"
          placeholder="类别"
          clearable
        >
          <el-option
            v-for="dict in categoryOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="handleQuery">查询</el-button>
        <el-button type="warning" @click="handleReset">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'SysUserQueryForm',
  data() {
    return {
      queryForm: {
        name: '',
        type: undefined
      },
      categoryOptions: []
    }
  },
  methods: {
    handleQuery() {
      this.$emit('query', this.queryForm)
    },
    handleReset() {
      this.$refs['queryForm'].resetFields()
      this.handleQuery()
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
